import i18n from '@/i18n';
const { t } = i18n.global as any;

export type NavItemType = {
  path: string;
  name: string;
  component: () => any;
  meta: {
    title: string;
    exclusiveToRoles?: string[];
  };
};

export const FatherName = {
  '/': t('appPageTitle.overview'),
  'system-management': t('appNavigation.systemManagement'),
  diagnostic: t('appNavigation.diagnostic'),
  'user-security': t('appNavigation.UserSecurity'),
  services: t('appNavigation.Services'),
  settings: t('appNavigation.settings'),
};

const roles = {
  administrator: 'Administrator',
  operator: 'Operator',
  readonly: 'ReadOnly',
  noaccess: 'NoAccess',
};

export default () => {
  return {
    '/': [
      {
        path: '/',
        name: 'overview',
        meta: {
          title: t('appPageTitle.overview'),
        },
      },
    ],
    systemManagement: [
      {
        path: '/system-management/system-information',
        name: 'system-information',
        meta: {
          title: t('appPageTitle.inventory'),
        },
      },
      {
        path: '/system-management/power',
        name: 'power',
        meta: {
          title: t('appPageTitle.power'),
        },
      },
      {
        path: '/system-management/sensors',
        name: 'sensors',
        meta: {
          title: t('appPageTitle.sensors'),
        },
      },
    ],
    diagnostic: [
      {
        path: '/diagnostic/event-logs',
        name: 'event-logs',
        meta: {
          title: t('appPageTitle.eventLogs'),
        },
      },
      {
        path: '/diagnostic/post-code-logs',
        name: 'post-code-logs',
        meta: {
          title: t('appPageTitle.postCodeLogs'),
        },
      },
    ],
    userSecurity: [
      {
        path: '/user-security/sessions',
        name: 'sessions',
        meta: {
          title: t('appPageTitle.sessions'),
        },
      },
      {
        path: '/user-security/ldap',
        name: 'ldap',
        meta: {
          title: t('appPageTitle.ldap'),
        },
      },
      {
        path: '/user-security/user-management',
        name: 'local-users',
        meta: {
          title: t('appPageTitle.userManagement'),
        },
      },
      {
        path: '/user-security/certificates',
        name: 'certificates',
        meta: {
          title: t('appPageTitle.certificates'),
        },
      },
      {
        path: '/user-security/policies',
        name: 'policies',
        meta: {
          title: t('appPageTitle.policies'),
        },
      },
    ],
    services: [
      {
        path: '/services/factory-reset',
        name: 'factory-reset',
        meta: {
          title: t('appPageTitle.factoryReset'),
        },
      },
      {
        path: '/services/kvm',
        name: 'kvm',
        meta: {
          title: t('appPageTitle.kvm'),
          exclusiveToRoles: [roles.administrator],
        },
      },
      {
        path: '/services/serial-over-lan',
        name: 'serial-over-lan',
        meta: {
          title: t('appPageTitle.serialOverLan'),
          exclusiveToRoles: [roles.administrator],
        },
      },
      {
        path: '/services/virtual-media',
        name: 'virtual-media',
        meta: {
          title: t('appPageTitle.virtualMedia'),
        },
      },
    ],
    settings: [
      {
        path: '/settings/network',
        name: 'network',
        meta: {
          title: t('appPageTitle.network'),
        },
      },
      {
        path: '/settings/firmware',
        name: 'firmware',
        meta: {
          title: t('appPageTitle.firmware'),
        },
      },
      {
        path: '/settings/date-time',
        name: 'date-time',
        meta: {
          title: t('appPageTitle.dateTime'),
        },
      },
      {
        path: '/settings/server-power-operations',
        name: 'server-power-operations',
        meta: {
          title: t('appPageTitle.serverPowerOperations'),
        },
      },
      {
        path: '/settings/reboot-bmc',
        name: 'reboot-bmc',
        meta: {
          title: t('appPageTitle.rebootBmc'),
        },
      },
      {
        path: '/settings/power-restore-policy',
        name: 'power-restore-policy',
        meta: {
          title: t('appPageTitle.powerRestorePolicy'),
        },
      },
    ],
  };
};
